#include <iostream>
#include <vector>

using namespace std;

int main()
{
    int f, h, k, u;
    string s;
    cin >> s;
    vector<char> v;
        for (int i = 0; i < s.size(); i++)
        {
            if (s[i] == '{' || s[i] == '[' || s[i] == '(' || s[i] == '<')
                {
                    v.push_back(s[i]);
                    k = 1;
                }
            if (s[i] == '}')
            {
                h = v[v.size() - 1];
                v.pop_back();
                if (h != '{')
                    {
                        f = 1;
                        break;
                    }
            }
            else if (s[i] == ']')
            {
                h = v[v.size() - 1];
                v.pop_back();
                if (h != '[')
                    {
                        f = 1;
                        break;
                    }
            }
            else if (s[i] == ')')
            {
                h = v[v.size() - 1];
                v.pop_back();
                if (h != '(')
                    {
                        f = 1;
                        break;
                    }
            }
            else if (s[i] == '>')
            {
                h = v[v.size() - 1];
                v.pop_back();
                if (h != '<')
                    {
                        f = 1;
                        break;
                    }
            }
            }
    if (f == 0 && k == 0)
    {
        cout << "False";
    }
    else if (v.size() == 0 && f == 0 && k == 1)
    {
        cout << "True";
    }
    else if (f == 1 || v.size() > 0)
    {
        cout << "False";
    }
    return 0;
}
